<template>
  <div class="baseinfo-custom-wrap">
    <!-- <el-collapse v-model='model'>
    <el-collapse-item name="1" title="基本信息">-->
    <Anchor ref="anchor" :labelList="labels">
      <div id="row-01" class="box">
        <!-- class="min-height" -->
        <FormPanel ref="baseInfoFormPanel" :list="baseInfoFormList" :cols="3" :labelWidth="110" :isSubmitBtn="false" @formChange="firstFormChangeHandle" />
      </div>
      <div id="row-02" class="box">
        <!-- </el-collapse-item>
        <el-collapse-item name="2">-->
        <FormPanel ref="secondFormPanel" :list="secondFormList" :cols="3" :labelWidth="110" :isSubmitBtn="false" @formChange="secondFormChangeHandle" />
      </div>
      <div id="row-03" class="box">
        <!-- </el-collapse-item>
        <el-collapse-item name="3" title="送修人">-->
        <ButtonArea :style="{ paddingLeft: '110px' }">
          <el-button type="primary" style="margin-bottom: 15px;" @click="synchronizationInfoFun">自动同步车主信息</el-button>
        </ButtonArea>
        <FormPanel ref="personFormPanel" :list="personFormList" :cols="3" :labelWidth="110" :isSubmitBtn="false" @formChange="thirdFormChangeHandle" />
      </div>
      <div id="row-04" class="box">
        <!-- </el-collapse-item>
        <el-collapse-item name="4" title="备注">-->
        <FormPanel ref="remarkFormPanel" :list="remarkFormList" :cols="1" :labelWidth="110" :isSubmitBtn="false" @formChange="fourthFormChangeHandle" />
        <!-- </el-collapse-item>
        </el-collapse>-->
      </div>
    </Anchor>
  </div>
</template>

<script>
// import {
//   brandsDicts,
//   seriessDict,
//   modelsDict,
//   packagesDict,
//   colorInfo,
//   queryServiceAss,
//   queryTechnician,
//   queryInsurance,
//   queryMaintain,
//   queryDCRC,
//   attachunit,
//   salesConsultant,
//   dealertCode,
//   queryDiscountMode,
//   protectRepair
// } from '@/api/repair/repairReception/customer/vehicleDetails';
import { dictionary } from '@/utils/dictMixin';
import moment from 'moment';
import _ from 'lodash';
export default {
  name: 'baseInfo',
  mixins: [dictionary],
  props: ['vin'],
  data() {
    this.synchronizationInfo = {};
    return {
      // model: ['1','2','3','4'],
      // labels: [
      //   { title: '基本信息', id: 'row-01' },
      //   { title: '其他信息', id: 'row-02' },
      //   { title: '送修人', id: 'row-03' },
      //   { title: '备注', id: 'row-04' }
      // ],
      labels: this.createAnchorLabels(),
      dmsFunc: {},
      baseInfoFormList: this.createBaseInfoFormList(),
      secondFormList: this.createSecondFormList(),
      personFormList: this.createPersonFormList(),
      remarkFormList: this.createRemarkFormList(),
      brandSeriesModelPackage: {}
    };
  },
  mounted() {
    this.dmsFunc = { dmsFuncId: 35100010 };
    // 工程师、人员信息接口
    this.queryServiceAssFun();
    this.queryTechnicianFun();
    this.queryInsuranceFun();
    this.queryMaintainFun();
    this.queryDCRCFun();
    // 其他字典
    this.attachunitFun();
    this.salesConsultantFun();
    this.dealertCodeFun();
    this.queryDiscountModeFun();

    // 品牌、车系、车型、配置接口
    this.brandsDictsFun();
    // this.seriessDictFun();
    // this.modelsDictFun();
    // this.packagesDictFun();
    // this.colorInfoFun();

    this.protectRepairFun(this.vin);
    setTimeout(() => {
      this.$refs.anchor.REFRESH();
    }, 100);
  },
  methods: {
    createAnchorLabels() {
      return [
        {
          title: '基本信息',
          id: 'row-01'
        },
        {
          title: '其他信息',
          id: 'row-02'
        },
        {
          title: '送修人',
          id: 'row-03'
        },
        {
          title: '备注',
          id: 'row-04'
        }
      ];
    },

    createBaseInfoFormList() {
      return [
        {
          type: 'INPUT',
          label: '车主编号',
          fieldName: 'OWNER_NO',
          // placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌代码', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '车主',
          fieldName: 'OWNER_NAME',
          // placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '车牌号',
          fieldName: 'LICENSE',
          // placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: 'VIN',
          fieldName: 'VIN',
          // placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌代码', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '发动机号',
          fieldName: 'ENGINE_NO',
          // placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '排气量',
          fieldName: 'EXHAUST_QUANTITY',
          // placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '年款',
          fieldName: 'YEAR_MODEL',
          // placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'DATE',
          label: '制造日期',
          fieldName: 'PRODUCT_DATE',
          valueFormat: 'yyyy-MM-dd',
          placeholder: '选择日期',
          change: val => {
            this.$refs.baseInfoFormPanel.SUBMIT_FORM();
          }
          // rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '品牌',
          fieldName: 'BRAND',
          placeholder: '请选择',
          change: val => {
            this.changeBrand(val);
            this.$refs.baseInfoFormPanel.SUBMIT_FORM();
          },
          itemList: [],
          rules: [{ required: false, message: '请选择品牌', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '车系',
          fieldName: 'SERIES',
          placeholder: '请选择',
          change: val => {
            this.changeSeries(val);
            this.$refs.baseInfoFormPanel.SUBMIT_FORM();
          },
          itemList: [], // [{ value: 10451001, text: '店面' }, { value: 10451003, text: '厂家' }],
          rules: [{ required: false, message: '请选择数据来源', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '车型',
          fieldName: 'MODEL',
          placeholder: '请选择',
          change: val => {
            this.changeModel(val);
            this.$refs.baseInfoFormPanel.SUBMIT_FORM();
          },
          itemList: [],
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '配置',
          fieldName: 'APACKAGE',
          placeholder: '请选择',
          change: val => {
            this.$refs.baseInfoFormPanel.SUBMIT_FORM();
          },
          itemList: [], // [{ value: 10451001, text: '店面' }, { value: 10451003, text: '厂家' }],
          rules: [{ required: false, message: '请选择数据来源', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '是否绑定微信号',
          fieldName: 'isValid',
          placeholder: '请选择',
          itemList: this.createDictList('1278'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'DATE',
          label: '绑定时间',
          fieldName: '',
          placeholder: '选择日期',
          disabled: true,
          rules: [{ required: false, message: '请选择日期', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '旧发动机号',
          fieldName: 'ENGINE_NO_OLD',
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '服务工程师',
          fieldName: 'EMPLOYEE_NO',
          placeholder: '请选择',
          itemList: this.createDictList('1004'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '排挡类别',
          fieldName: 'SHIFT_TYPE',
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '燃料类别',
          fieldName: 'FUEL_TYPE',
          placeholder: '请选择',
          itemList: this.createDictList('1238'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '营运性质',
          fieldName: 'BUSINESS_KIND',
          placeholder: '请选择',
          itemList: this.createDictList('1194'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '指定技师',
          fieldName: 'EMPLOYEE_NO',
          placeholder: '请选择',
          itemList: [],
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '颜色',
          fieldName: 'COLOR_CODE',
          placeholder: '请选择',
          itemList: [],
          rules: [{ required: false, message: '请选择颜色', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '车辆用途',
          fieldName: 'VEHICLE_PURPOSE',
          placeholder: '请选择',
          itemList: this.createDictList('1193'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '变速箱号',
          fieldName: 'GEAR_BOX',
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '钥匙号',
          fieldName: 'KEY_NUMBER',
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '厂牌型号',
          fieldName: 'BRAND_MODEL',
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '内饰色',
          fieldName: 'INNER_COLOR',
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '续保专员',
          fieldName: 'INSURANCE_ADVISOR',
          placeholder: '请选择',
          itemList: this.createDictList('1004'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '定保专员',
          fieldName: 'EMPLOYEE_NO',
          placeholder: '请选择',
          itemList: this.createDictList('1004'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '产地',
          fieldName: 'PRODUCTING_AREA',
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: 'DCRC专员',
          fieldName: 'EMPLOYEE_NO',
          placeholder: '请选择',
          itemList: this.createDictList('1004'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '运营车挂方式',
          fieldName: 'AVCHORED',
          placeholder: '请选择',
          itemList: this.createDictList('1507'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '挂靠单位',
          fieldName: 'UNIT_ATTACHCODE',
          placeholder: '请选择',
          itemList: [],
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: 'VSN',
          fieldName: 'VSN',
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '排放标准',
          fieldName: 'DISCHARGE_STANDARD',
          placeholder: '请选择',
          itemList: this.createDictList('3010'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '置换意向车型',
          fieldName: 'REBUY_INTENT_MODEL',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'DATE',
          label: '置换日期',
          fieldName: 'REPLACE_DATE',
          placeholder: '选择日期'
          // rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '延长质保合同编号',
          fieldName: '',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '购买方式',
          fieldName: 'WAYS_TO_BUY',
          placeholder: '请选择',
          itemList: this.createDictList('1067'),
          rules: [{ required: false, message: '请选择整车销售', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '保修手册号码',
          fieldName: 'HANDBOOK_NO',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '更换发动机事项说明',
          fieldName: '',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '重构意向车型',
          fieldName: 'REBUY_INTENT_MODEL',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'DATE',
          label: '重构日期',
          fieldName: 'REBUY_DATE',
          placeholder: '选择日期'
          // rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
        }
      ];
    },
    createSecondFormList() {
      return [
        {
          type: 'SELECT',
          label: '经销商',
          fieldName: 'dealerCode',
          placeholder: '请选择',
          disabled: true,
          itemList: this.createDictList('1004'),
          rules: [{ required: false, message: '请选择品牌', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '首席顾问师',
          fieldName: 'USER_ID',
          placeholder: '请选择',
          itemList: this.createDictList('1004'), // [{ value: 10451001, text: '店面' }, { value: 10451003, text: '厂家' }],
          rules: [{ required: false, message: '请选择数据来源', trigger: 'change' }]
        },
        {
          type: 'DATE',
          label: '开票日期',
          fieldName: 'SALES_DATE',
          placeholder: '选择日期'
          // rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '销售里程',
          fieldName: 'SALES_MILEAGE',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'DATE',
          label: '上牌日期',
          fieldName: 'LICENSE_DATE',
          placeholder: '选择日期'
          // rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
        },
        {
          type: 'SELECT',
          label: '本公司购车',
          fieldName: 'IS_SELF_COMPANY',
          placeholder: '请选择',
          itemList: this.createDictList('1278'), // [{ value: 10451001, text: '店面' }, { value: 10451003, text: '厂家' }],
          rules: [{ required: false, message: '请选择本公司购车', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '客户编号',
          fieldName: 'CUSTOMER_NO',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'DATE',
          label: '营运证日期',
          fieldName: 'BUSINESS_DATE',
          placeholder: '选择日期'
          // rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '合约编号',
          fieldName: 'CONTRACT_NO',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'DATE',
          label: '签约日期',
          fieldName: 'CONTRACT_DATE',
          placeholder: '选择日期'
          // rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: 'VIP编号',
          fieldName: 'VIP_NO',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '预收款',
          fieldName: 'PRE_PAY',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '优惠模式',
          fieldName: 'DISCOUNT_MODE_CODE',
          placeholder: '请选择',
          itemList: [], // [{ value: 10451001, text: '店面' }, { value: 10451003, text: '厂家' }],
          rules: [{ required: false, message: '请选择优惠模式', trigger: 'change' }]
        },
        {
          type: 'DATE',
          label: '优惠截止日期',
          fieldName: 'DISCOUNT_EXPIRE_DATE',
          placeholder: '选择日期'
          // rules: [{ required: true, message: '请选择日期', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '固定资产管理号',
          fieldName: '',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '欠款金额',
          fieldName: 'ARREARAGE_AMOUNT',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        }
      ];
    },
    createPersonFormList() {
      return [
        {
          type: 'INPUT',
          label: '姓名',
          fieldName: 'DELIVERER',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '性别',
          fieldName: 'DELIVERER_GENDER',
          placeholder: '请选择',
          itemList: this.createDictList('1006'), // [{ value: 10451001, text: '店面' }, { value: 10451003, text: '厂家' }],
          rules: [{ required: false, message: '请选择性别', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '与车主关系',
          fieldName: 'DELIVERER_RELATION_TO_OWNER',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '喜欢的联络方式',
          fieldName: 'DELIVERER_HOBBY_CONTACT',
          placeholder: '请选择',
          itemList: this.createDictList('1231'), // [{ value: 10451001, text: '店面' }, { value: 10451003, text: '厂家' }],
          rules: [{ required: false, message: '请选择数据来源', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '电话',
          fieldName: 'DELIVERER_PHONE',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '手机',
          fieldName: 'DELIVERER_MOBILE',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '身份证号',
          fieldName: 'DELIVERER_CREDIT',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '邮编',
          fieldName: 'ZIP_CODE',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'SELECT',
          label: '三日电访时间',
          fieldName: 'TRACE_TIME',
          placeholder: '请选择',
          itemList: this.createDictList('1125'), // [{ value: 10451001, text: '店面' }, { value: 10451003, text: '厂家' }],
          rules: [{ required: false, message: '请选择数据来源', trigger: 'change' }]
        },
        {
          type: 'INPUT',
          label: '地址',
          fieldName: 'DELIVERER_ADDRESS',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        },
        {
          type: 'INPUT',
          label: '工作单位',
          fieldName: 'DELIVERER_COMPANY',
          placeholder: '请输入...',
          disabled: true
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        }
      ];
    },
    createRemarkFormList() {
      return [
        {
          type: 'TEXT_AREA',
          label: '备注',
          fieldName: 'REMARK',
          // style: {width: '100vh'},
          placeholder: '请输入...'
          // disabled: true,
          // rules: [{ required: false, message: '请输入品牌名称', trigger: 'blur' }]
        }
      ];
    },
    async queryServiceAssFun() {
      const res = await queryServiceAss(this.dmsFunc);
      this.baseInfoFormList[15].itemList = res.map(x => ({ value: x.EMPLOYEE_NO, text: x.EMPLOYEE_NAME }));
    },
    async queryTechnicianFun() {
      const res = await queryTechnician(this.dmsFunc);
      this.baseInfoFormList[19].itemList = res.map(x => ({ value: x.EMPLOYEE_NO, text: x.EMPLOYEE_NAME }));
    },
    async queryInsuranceFun() {
      const res = await queryInsurance(this.dmsFunc);
      this.baseInfoFormList[26].itemList = res.map(x => ({ value: x.EMPLOYEE_NO, text: x.EMPLOYEE_NAME }));
    },
    async queryMaintainFun() {
      const res = await queryMaintain(this.dmsFunc);
      this.baseInfoFormList[27].itemList = res.map(x => ({ value: x.EMPLOYEE_NO, text: x.EMPLOYEE_NAME }));
    },
    async queryDCRCFun() {
      const res = await queryDCRC(this.dmsFunc);
      this.baseInfoFormList[29].itemList = res.map(x => ({ value: x.EMPLOYEE_NO, text: x.EMPLOYEE_NAME }));
    },
    // 其他字典
    async attachunitFun() {
      const res = await attachunit(this.dmsFunc);
      this.baseInfoFormList[31].itemList = res.map(x => ({ value: x.UNIT_ATTACHCODE, text: x.UNIT_ATTACHNAME }));
    },
    async dealertCodeFun() {
      const res = await dealertCode(this.dmsFunc);
      this.secondFormList[0].itemList = res.map(x => ({ value: x.DEALER_CODE, text: x.USER_NAME }));
    },
    async salesConsultantFun() {
      const res = await salesConsultant(this.dmsFunc);
      this.secondFormList[1].itemList = res.map(x => ({ value: x.USER_ID, text: x.USER_NAME }));
    },
    async queryDiscountModeFun() {
      const res = await queryDiscountMode(this.dmsFunc);
      this.secondFormList[12].itemList = res.map(x => ({ value: x.DISCOUNT_MODE_CODE, text: x.DISCOUNT_MODE_NAME }));
    },
    // 品牌车系车型配置
    async brandsDictsFun() {
      const res = await brandsDicts(this.dmsFunc);
      this.baseInfoFormList[8].itemList = res.map(x => ({ value: x.BRAND_CODE, text: x.BRAND_NAME }));
    },
    async seriessDictFun() {
      const res = await seriessDict(this.dmsFunc, this.brandSeriesModelPackage);
      // this.seriessDictList = _.clone(res);
      this.baseInfoFormList[9].itemList = res.map(x => ({ value: x.SERIES_CODE, text: x.SERIES_NAME }));
    },
    async modelsDictFun() {
      const res = await modelsDict(this.dmsFunc, this.brandSeriesModelPackage);
      this.baseInfoFormList[10].itemList = res.map(x => ({ value: x.MODEL_CODE, text: x.MODEL_NAME }));
    },
    async colorInfoFun() {
      const res = await colorInfo(this.dmsFunc, this.brandSeriesModelPackage);
      this.baseInfoFormList[20].itemList = res.map(x => ({ value: x.COLOR_CODE, text: x.COLOR_NAME }));
    },
    async packagesDictFun() {
      const res = await packagesDict(this.dmsFunc, this.brandSeriesModelPackage);
      this.baseInfoFormList[11].itemList = res.map(x => ({ value: x.CONFIG_CODE, text: x.CONFIG_NAME }));
    },
    changeBrand(val) {
      if (val === '') {
        this.baseInfoFormList[9].itemList = [];
        return;
      }
      this.brandSeriesModelPackage = {
        brand: val
      };
      this.seriessDictFun();
    },
    changeSeries(val) {
      if (val === '') {
        return;
      }
      this.brandSeriesModelPackage = {
        ...this.brandSeriesModelPackage,
        series: val
      };
      this.modelsDictFun();
      this.colorInfoFun();
    },
    changeModel(val) {
      if (val === '') {
        return;
      }
      this.brandSeriesModelPackage = {
        ...this.brandSeriesModelPackage,
        model: val
      };
      this.packagesDictFun();
    },
    async protectRepairFun(val) {
      const res = (await protectRepair(this.dmsFunc, val)).data;
      if (res.BRAND) {
        this.brandSeriesModelPackage = {
          brand: res.BRAND
        };
      }
      if (res.SERIES) {
        this.brandSeriesModelPackage = {
          ...this.brandSeriesModelPackage,
          series: res.SERIES
        };
      }
      if (res.MODEL) {
        this.brandSeriesModelPackage = {
          ...this.brandSeriesModelPackage,
          model: res.MODEL
        };
      }
      // 品牌、车系、车型、配置接口
      this.seriessDictFun();
      this.modelsDictFun();
      this.packagesDictFun();
      this.colorInfoFun();
      this.baseInfoFormList.forEach(x => {
        if (x.fieldName === 'PRODUCT_DATE') {
          if (res[x.fieldName] !== null) {
            let dataFormate = moment(res[x.fieldName]).format('YYYY-MM-DD');
            x.initialValue = dataFormate;
          }
        } else {
          x.initialValue = res[x.fieldName];
        }
      });
      this.secondFormList.forEach(x => {
        x.initialValue = res[x.fieldName];
      });
      this.personFormList.forEach(x => {
        x.initialValue = res[x.fieldName];
      });
      this.synchronizationInfo = res;
      this.remarkFormList.forEach(x => {
        x.initialValue = res[x.fieldName];
      });
    },
    synchronizationInfoFun() {
      this.personFormList.forEach(x => {
        x.initialValue = this.synchronizationInfo[x.fieldName];
      });
    },
    firstFormChangeHandle(val) {
      this.$emit('formChangeHandle', val);
    },
    secondFormChangeHandle(val) {
      this.$emit('formChangeHandle', val);
    },
    thirdFormChangeHandle(val) {
      this.$emit('formChangeHandle', val);
    },
    fourthFormChangeHandle(val) {
      this.$emit('formChangeHandle', val);
    }
  }
};
</script>

<style lang="less">
.baseinfo-custom-wrap {
  height: calc(100vh - 175px);
  .min-height {
    height: 100%;
  }
}
.box {
  border: 1px solid #ccc;
  padding-top: 15px;
  padding-right: 15px;
  border-radius: @borderRadius;
  margin-bottom: 20px;
  box-shadow: @boxShadow;
}
</style>
